﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Inovout.Office.Excel;
using Inovout.Report;
using System.IO.Packaging;

namespace Inovout.ExcelReport
{
    /// <summary>
    /// Excel报表文档，主要敷衍EXCEL作为ReportViewer, 同时将Report相关XML以部件形式存储在xlsx包中。
    /// </summary>
    public class ExcelReportDocument : ExcelDocument
    {

        public ExcelReportDocument(string excelReportFileName)
            : base(excelReportFileName)
        {
            Uri dataSourceSetPartUri = PackUriHelper.CreatePartUri(
                               new Uri(dataSourceSetPath, UriKind.Relative));
            reportDataSourceSet = new ReportDataSourceSet(GetXmlByUri(dataSourceSetPartUri));
        }
        private const string dataSourceSetPath = @"report\dataSourceSet.xml";
        private ReportDataSourceSet reportDataSourceSet;
        private void BuildReportData()
        {
            reportDataSourceSet.GetReportData();
        }
        public void Save(string excelFileName)
        {
            BuildReportData();
        }
    }
}
